/*
 * To change this license header, choose License Headers in Project Properties. To change this
 * template file, choose Tools | Templates and open the template in the editor.
 */
package chalmers.game.subterranean.ui.view.world.level;

import chalmers.game.subterranean.util.BlockType;
import chalmers.game.subterranean.util.options.Sprites;
import javafx.scene.image.ImageView;

/**
 * 
 * @author TH
 */
public class SquareView {
  public final ImageView view;

  public SquareView(BlockType type) {
    view = new ImageView();
    setView(type);

  }

  public void setView(BlockType type) {
    switch (type.dig) {
      case AIR:
        view.setImage(Sprites.AIR_SPRITE);
        break;
      case DIRT:
        view.setImage(Sprites.DIRT_SPRITE);
        break;
    }

    switch (type.action) {
      case SHOP:
        view.setImage(Sprites.SHOP_SPRITE);
        break;
      case LADDER:
        view.setImage(Sprites.LADDER_SPRITE);
        break;
      case TELEPORT:
        view.setImage(Sprites.TELEPORT_SPRITE);
    }

    switch (type.resource) {
      case IRON:
        view.setImage(Sprites.IRON_SPRITE);
        break;
      case DIAMOND:
        view.setImage(Sprites.DIAMOND_SPRITE);
        break;
      case COAL:
        view.setImage(Sprites.COAL_SPRITE);
        break;
    }
  }

  public void destroy() {
    view.setImage(Sprites.AIR_SPRITE);
  }

  public void setLadder() {
    view.setImage(Sprites.LADDER_SPRITE);
  }

  public void damage() {
    System.out.print("DAMAGE BLOCK PLACEHOLDER\n"); // TODO fix this!!
  }
}
